package com.jlpay.openapi.demo.fund.deferred;

import com.jlpay.open.jlpay.sdk.java.model.BaseResponse;
import com.jlpay.open.jlpay.sdk.java.model.fund.deferred.request.FundFreezeRequest;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author chenjunhong
 * @since 2024/12/20
 */
public class FundFreezeService {

    private static final Logger LOGGER = LoggerFactory.getLogger(FundFreezeService.class);

    public static void main(String[] args) {
        FundFreezeRequest fundFreezeRequest = buildFundFreezeRequest();
        BaseResponse fundFreezeResponse = JlpayOpenApiService.openMerchService()
                .post(fundFreezeRequest, BaseResponse.class);
        LOGGER.info("资金冻结响应:{}", JsonUtils.toString(fundFreezeResponse));
    }

    private static FundFreezeRequest buildFundFreezeRequest() {
        FundFreezeRequest fundFreezeRequest = new FundFreezeRequest();
        fundFreezeRequest.setOutOrderId("test_freeze_202412200001");
        fundFreezeRequest.setMerchNo("849551860110001");
        fundFreezeRequest.setTransactionId("411128056694704147660848");
        fundFreezeRequest.setFreezeAmount("100");
        fundFreezeRequest.setReason("冻结测试");
        fundFreezeRequest.setRemark("冻结测试");
        return fundFreezeRequest;
    }
}
